﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;

namespace pushdir
{
    class Program
    {
        public class AnimalTypeAttribute : Attribute
        {
            public AnimalTypeAttribute(int pet)
            {
                thePet = pet;
            }

            // Keep a variable internally ...
            protected int thePet;

            // .. and show a copy to the outside world.
            public int Pet
            {
                get { return thePet; }
                set { thePet = value; }
            }
        }

        public class Test
        {

            public void Calc(int i)
            {
                //Environment.SetEnvironmentVariable("PUSHDIR", currentPath);

                Console.WriteLine("still null");
                return;
            }

            [AnimalTypeAttribute(2)]
            public void CalcTest(int i, int j)
            {

            }

            [AnimalTypeAttribute(1)]
            public int TestMember { get; set; }
        }

        static void Main(string[] args)
        {
            Test t = new Test();

            MemberInfo[] mInfo = t.GetType().GetMembers();

            foreach (MemberInfo m in mInfo)
            {
                System.Diagnostics.Trace.WriteLine("#######" + m.Name);
                object[] att = m.GetCustomAttributes(true);

                if (att!=null && att.Length > 0)
                {
                    int i = 0;

                    foreach (object o in att)
                    {
                        if (o is AnimalTypeAttribute)
                        {
                            int j = 0;
                        }
                    }
                }

            }
        }
    }
}
